
<!DOCTYPE html>
<html lang="en">
  <script type="text/javascript" src="/js/jquery.js"></script>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录</title>
  <meta id="myKeywords" name="keywords" content="" />
  <meta name="description" content="" />
  <script type="text/javascript" src="{{ asset('js/module.js') }}"></script>
  <link rel="stylesheet" href="{{ asset('css/module.css') }}">
  <style>
    body{font-size: 2rem;}
    #loginImg{width:13rem;height:13rem;margin:8rem auto 0;}
    #loginImg>img{width:100%;height:100%;border-radius: 50%;}

    /* input框 */
    #signinform>div{width:70%;margin:0 auto;}
    #signinform #usename{position: relative;margin-top:3rem;text-align: center;position: relative;}
    #signinform #usepwd{margin-top:3rem;text-align: center;position: relative;}
    #signinform input{width:100%;height:40px;outline: none;border:none;background:0;border-bottom:1px solid #BDBDBD;font-size:16px;}
    #signinform input::-webkit-input-placeholder{margin-left: 30px;color:#333333;text-align: center;display: block;}
    #signinform #button{width:65%;height:6rem;color:#fff;background-color:#f60d00;border-radius: 25px;text-align: center;line-height:6rem;margin:6rem auto;}
    .disc{-webkit-text-security:disc;}
    #signinform input::-webkit-input-placeholder{position: absolute;top:1rem;left:0;bottom:0;right:0;margin:auto;}
  </style>
</head>
<body>
  <div style="position: fixed;
  width: 100%;
  top: 0;
  left: 0;">
    <div id="loginImg">
      <img src="" alt="">
    </div>
    <form id="signinform" action="">
      <div>
        <input id="usename" type="text" placeholder="账号" name="username"><span style="font-size:12px;display:block;" id="usertips"></span>
      </div>
      <div>
        <input id="usepwd" type="text" placeholder="密码"><span style="font-size:12px;display:block;" id="pwdrtips"></span>
      </div>
      <div id="button">登 录</div>
    </form>
  </div>
</body>
</script>
<script>
  $("#loginImg>img").attr("src",http+"img/logo.png")
  // 登录页面密码改为点
  $("#usepwd").focus(function(){
    $("#usepwd").addClass('disc');
  })
  $("#usepwd").blur(function(){
    if($("#usepwd").val()=="密码" || $("#usepwd").val()==""){
      $("#usepwd").removeClass('disc');
    }
  })

  $("#button").on("click",function(){
    if($("#usename").val()==''){
      newalert('请输入用户名',1000)
    }else if($("#usepwd").val()==''){
      newalert('请输入密码',1000)
    }else{
      $.ajax({
        type: "POST",
        url: "api/login",
        data: {
          job_number:$("#usename").val(),
          password:$("#usepwd").val(),
        },
        dataType: "json",
        success: function(date) {
          console.log(date)
          if(date.code==0){
            localStorage.setItem("mytokens", date.data);
            newalert("登录成功",1000)
            setTimeout(function(){
              window.location.href='http://meal.zyy.sn.cn/'
            },1000)

          }else{
            newalert('用户名或密码不正确',1000)
          }
        }
      })
    }
  })







</script>
</html>
